#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		string s;
		cin >> n >> s;
		int pluss, minuss;
		pluss = minuss = 0;
		for (auto ii : s) {
			if (ii == '+')
				pluss++;
			else
				minuss++;
		}
		cout << abs(pluss - minuss) << endl;
	}
	return 0;
}
